package py.edu.ucom.cadira.auth;


import java.util.MissingResourceException;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

public class AutenticadorDeArchivo implements Autenticador {

	@Override
	public void verificarCredenciales(String user, String passwd)
		throws LoginInvalidoException {
		String passwdRet;
		
		try {
			ResourceBundle RB = PropertyResourceBundle.getBundle("fileLogin");
			passwdRet = RB.getString(user);
			if(passwdRet == null){
				throw new LoginInvalidoException("El usuario no existe");
			}
			else if(!passwdRet.equals(passwd)){
				throw new LoginInvalidoException("Invalid password");
			}
			
		} catch (MissingResourceException e) {
			throw new LoginInvalidoException("El usuario no existe");
		}


	}

}
